﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;

using CE.Database;
using CE.Global;
using CE.HR;

public partial class HR_hr_list : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetResultTable();
        }
    }
    private void GetResultTable()
    {
        MyDatabase _db = new MyDatabase();
        DataTable _dtResult = new DataTable();
        string _spName = "[sprocHRSelectList]";
        SortedList _sPara = new SortedList();
        _sPara.Add("@OrderBy", "HRID");
        _dtResult = _db.GetDataTableBySP(_spName, _sPara);

        if (_dtResult.Rows.Count > 0)
        {
            gvHR.DataSource = _dtResult;
            gvHR.DataBind();
        }
    }
    protected void gvHR_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "DeleteJob")
        {
            int _hrid = int.Parse(e.CommandArgument.ToString());
            HRAccountDB _hraccountdb = new HRAccountDB();
            Int64 result = _hraccountdb.DeleteUserByID(_hrid);
            if (result > 0)
            {
                GetResultTable();
            }
        }
    }
}
